from sqlalchemy import Column, String, Integer, DateTime, Text, Double
from sqlalchemy.orm import declarative_base


Base = declarative_base()
# 用户表
class User(Base):
    __tablename__ = 'user'
    id = Column(Integer, primary_key=True)
    username = Column(String(50))
    password = Column(String(50))
    position = Column(String(50))
    avatar = Column(String(50))
    create_time = Column(DateTime)
    interview_num = Column(Integer)
    answer_num = Column(Integer)
    interview_time = Column(Double)
    position_by_ai = Column(String(50))

# 简历表
class Resume(Base):
    __tablename__ = 'resume'
    id = Column(Integer, primary_key=True)
    resume_id = Column(String(50))
    resume_url = Column(String(50))
    resume_content = Column(Text)
    username = Column(String(50))
    resume_img = Column(String(50))

# 论坛文章表
class Post(Base):
    __tablename__ = 'post'
    id = Column(Integer, primary_key=True)
    post_id = Column(String(50))
    post_title = Column(String(50))
    post_author = Column(String(50))
    post_author_avatar = Column(String(50))
    post_publish_time = Column(DateTime)
    post_content = Column(Text)
    post_abstract = Column(String(50))
    post_pic = Column(String(50))
    post_like_num = Column(Integer)
    post_comment_num = Column(Integer)

# 岗位技能视频表
class Video(Base):
    __tablename__ = 'video'
    id = Column(Integer, primary_key=True)
    video_id = Column(String(50))
    video_name = Column(String(50))
    video_author = Column(String(50))
    video_publish_time = Column(DateTime)
    video_pic = Column(String(50))
    video_url = Column(String(50))
    video_type = Column(Integer) # 0-技能视频，1-面试视频

# 视频评论表
class VideoComment(Base):
    __tablename__ = 'video_comment'
    id = Column(Integer, primary_key=True)
    comment_id = Column(String(50))
    comment_author = Column(String(50))
    comment_author_avatar = Column(String(50))
    comment_time = Column(DateTime)
    comment_content = Column(String(50))
    comment_like_num = Column(Integer)
    comment_dislike_num = Column(Integer)
    video_id = Column(String(50))

# 视频关联表
class RelatedVideo(Base):
    __tablename__ = 'related_video'
    id = Column(Integer, primary_key=True)
    video_id = Column(String(50))
    related_id = Column(String(50))

# 视频观看历史
class LearnHistory(Base):
    __tablename__ = 'learn_history'
    id = Column(Integer, primary_key=True)
    username = Column(String(50))
    video_id = Column(String(50))
    watch_history_time = Column(DateTime)

# 面试题库表
class QuestionBank(Base):
    __tablename__ = 'question_bank'
    id = Column(Integer, primary_key=True)
    question_id = Column(String(50))
    question_number = Column(Integer)
    question_title = Column(String(50))
    question_answer_abstarct = Column(Text)
    tag = Column(String(50))
    type = Column(Integer)

# 面试题库问题评论表
class QuetsionComment(Base):
    __tablename__ = 'quetsion_comment'
    id = Column(Integer, primary_key=True)
    comment_id = Column(String(50))
    comment_author = Column(String(50))
    comment_author_avatar = Column(String(50))
    comment_time = Column(DateTime)
    comment_content = Column(Text)
    comment_like_num = Column(Integer)
    comment_dislike_num = Column(Integer)
    question_id = Column(String(50))

class RelatedQuestion(Base):
    __tablename__ = 'related_question'
    id = Column(Integer, primary_key=True)
    question_id = Column(String(50))
    related_id = Column(String(50))

# 交流论坛评论表
class Comment(Base):
    __tablename__ = 'post_comment'
    id = Column(Integer, primary_key=True)
    comment_id = Column(String(50))
    comment_author = Column(String(50))
    comment_author_avatar =Column(String(50))
    comment_time = Column(DateTime)
    comment_content = Column(Text)
    comment_like_num = Column(Integer)
    comment_dislike_num = Column(Integer)
    post_id = Column(String(50))

# 热门文章表
class HotPost(Base):
    __tablename__ = 'hot_post'
    id = Column(Integer, primary_key=True)
    post_id = Column(String(50))
    post_title = Column(String(50))
    browse_num = Column(Integer)

# 热门评论表
class HotComment(Base):
    __tablename__ = 'hot_comment'
    id = Column(Integer, primary_key=True)
    comment_id = Column(String(50))
    comment_author = Column(String(50))
    comment_author_avatar = Column(String(50))
    comment_time = Column(DateTime)
    comment_content = Column(String(50))
    comment_like_num = Column(Integer)
    comment_dislike_num = Column(Integer)

# 帖子收藏表
class PostFavor(Base):
    __tablename__ = 'post_favor'
    id = Column(Integer, primary_key=True)
    username = Column(String(50))
    post_id = Column(String(50))

# 面试记录表
class InterviewRecord(Base):
    __tablename__ = 'interview_record'
    id = Column(Integer, primary_key=True)
    professional_knowledge = Column(Double)
    adaptability = Column(Double)
    skill_match = Column(Double)
    innovation = Column(Double)
    communication = Column(Double)
    logical_thinking = Column(Double)
    evaluation = Column(Text)
    interview_time = Column(DateTime)
    username = Column(String(50))
    professional_knowledge_evaluate = Column(Text)
    adaptability_evaluate = Column(Text)
    skill_match_evaluate = Column(Text)
    innovation_evaluate = Column(Text)
    communication_evaluate = Column(Text)
    logical_thinking_evaluate = Column(Text)
    professional_knowledge_advice = Column(Text)
    adaptability_advice = Column(Text)
    skill_match_advice = Column(Text)
    innovation_advice = Column(Text)
    communication_advice = Column(Text)
    logical_thinking_advice = Column(Text)
